package day10.Stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;

public class Lian01 {
    public static void main(String[] args) {
//        method1(); 单列集合
//        method2(); 双列集合
//        method3(); 数组
//        打印同种类型的多个数据
//        stream.of(1,2,3,4,5,6).forEach(s-> System.out.println(s));
    }

    private static void method3() {
        int[]arr={1,2,3,4,5};
        Arrays.stream(arr).forEach(s-> System.out.println(s));
    }

    private static void method2() {
        HashMap<String,Integer> hm=new HashMap<>();
        hm.put("zhangsan",23);
        hm.put("lisi",24);
        hm.put("wangwu",25);
        hm.put("zhapliu",26);
        hm.put("qianqi",27);
        hm.keySet().forEach(s -> System.out.println("打印所有键"+s));
        System.out.println("---------");
        hm.entrySet().stream().forEach(s -> System.out.println("打印所有键值对"+s) );
    }

    private static void method1() {
        ArrayList<String> list=new ArrayList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");
        list.stream().forEach(s -> System.out.println(s));
    }
}
